
import store from "@/vuex/store.js"
function showActionSheet() {
  var actionbuttons = [{title: "拍照"}, {title: "相册选取"}];
  var actionstyle = {title: "选择照片", cancel: "取消", buttons: actionbuttons};
  plus.nativeUI.actionSheet(actionstyle, function (e) {
    if (e.index == 1) {   //拍照
      getImg();
    } else if (e.index == 2) {  //选择相册
      galleryImg();
    }
  })
}

function getImg() {//打开相机
  plus.camera.getCamera().captureImage(function (p) {
    plus.io.resolveLocalFileSystemURL(p, function (entry) {
      store.commit('issueCover',entry.toLocalURL())
    });
  });

}

function galleryImg() {//获取相册
  plus.gallery.pick(function (p) {
    store.commit('issueCover',p)
  });
}


export default {
  showActionSheet,//选取来源
}
